<?php

namespace App\Models;
use App\Models\Topic;
/**
 * Class Blog
 * @property integer id
 * @property string type 类型
 * @property integer type_id 类型ID
 * @property integer product_id 商品ID
 * @property integer sort 排序
 */
class ProductRelation extends ApplicationModel
{
    protected $fillable = [
        'type',
        'type_id',
        'product_id',
        'sort',
        'price',
    ];

    public function product()
    {
        return $this->belongsTo(Product::class);
    }

    public function topic()
    {
        return $this->belongsTo(Topic::class,'type_id');
    }
    public function sale()
    {

        return $this->belongsTo(Sale::class, 'type_id');
    }




}
